package com.aacar.controller;

import java.io.IOException;

import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.io.IOUtils;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController extends ValidController{
	
	
	@RequestMapping("/test1")
	@ResponseBody
//	@MemLoginKeyValid(desc="validatetoken")
	public Object test(@RequestHeader(value="mobilehead") String mobilehead,HttpServletRequest req) {
		ServletInputStream input = null;
		String contentStr = "";
		try {
			input = req.getInputStream();
			contentStr= IOUtils.toString(input, "utf-8");
		} catch (IOException e) {
			e.printStackTrace();
		}
		System.out.println(input.toString());
		System.out.println(11111);
		System.out.println(2222);
		System.out.println(contentStr);
		return 123;
	}
	
	/**
	 * 
	 * @return
	 */
	@RequestMapping("/whtest")
	@ResponseBody
	public Object test() {
		return 12222;
	}
	

}
